''' convert a list of csv file to tiff format
'''

import csv_read
import cv2
import numpy as np

if __name__ == '__main__':

    for i in range(2, 24):
        filename = 'AA0622%02d' % i
        ir_array = csv_read.read_img_from_csv(r"F:\工作\红外三维\处理后数据\csv\160622AA\%s.csv" % filename)
        min_temp = np.min(ir_array)
        max_temp = np.max(ir_array)
        print(min_temp)
        print(max_temp)
            
        ir_scale = (ir_array - np.ones(np.shape(ir_array)) * min_temp) * (1 / (max_temp - min_temp))

        max_pix_value = 65535#int((max_temp - min_temp) / 0.01)

        ir_gray = np.uint16(ir_scale * max_pix_value)
        cv2.imwrite('%s.tif' % filename, ir_gray)